package com.vv.tools.common.support;


import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonIgnore;

import java.io.Serializable;
import java.time.LocalDateTime;

import lombok.Getter;
import lombok.Setter;

/**
 * @author liwen
 */
@Getter
@Setter
public class BaseModel implements Serializable {

    protected Long id;

    /**
     * 创建人
     */
    @TableField(fill = FieldFill.INSERT)
    protected String creator;

    /**
     * 创建日期
     */
    @TableField(fill = FieldFill.INSERT)
    protected LocalDateTime gmtCreated;

    /**
     * 修改人
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    protected String modifier;

    /**
     * 修改日期
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    protected LocalDateTime gmtModified;

    /**
     * 是否逻辑删除 char(1) comment '删除标识：N-未删除；Y-已删除'
     */
    @TableLogic(value = "N", delval = "Y")
    @TableField(fill = FieldFill.INSERT)
    protected String isDeleted = "N";

    @JsonIgnore
    public boolean isDeleted() {
        return "Y".equals(isDeleted);
    }

}
